'''
Created on 27/apr/09

@author: Riccardo Cagnasso
'''
from google.appengine.ext import webapp
from google.appengine.api import users
from google.appengine.ext.webapp import template

class AuthHandler(webapp.RequestHandler):
    '''
    This is the class to extend to obtain
    a request handler for authenticated pages
    '''
    
    def post(self):
        self.auth()
    
    def get(self):
        self.auth()
        
    def auth(self):
        pass
        """self.logout=users.create_logout_url(self.request.uri)
        user = users.get_current_user()
        if not user:
            self.redirect(users.create_login_url(self.request.uri))"""
            
            
    def displayTemplate(self,path,template_vars):
        template_vars['logout_url']=users.create_logout_url(self.request.uri)
        return template.render(path,template_vars)